home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5713 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  8.1 KB

  1. Path: comma.rhein.de!serpens!not-for-mail
  2. From: mlelstv@serpens.rhein.de (Michael van Elst)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: FPU: What am I doing wrong???
  5. Date: 18 Mar 1996 23:58:28 +0100
  6. Organization: dis-
  7. Message-ID: <4ikpqk$ds@serpens.rhein.de>
  8. NNTP-Posting-Host: serpens.rhein.de
  9.  
  10. I'm posting this for Chuck Davis (roshicorp@roshi.corp.earthlink.net),
  11. please reply to him directly.
  12. ____________________________________________________________________
  13.  
  14.   
  15.    I wonder if you might know what's happening that I don't seem to
  16. understand? This is my first experience in trying to use the FPU.
  17. The DFT routines are three versions of the same thing.
  18. I'm using PhxAss for all three assemblies.
  19.  
  20. CPU 68030
  21. FPU
  22.  
  23.   The first version works but, of course, is too slow as it is
  24. used in an _interrupt_ routine and each interrupt is 8ms.
  25. 128 sample/sec. This used the ascii version of the sin/cos
  26. routines converted for FFP.
  27.  
  28.   In the second routine, I'm trying to get at the FPU via the IEEE
  29. libraries. Immediate crash! Guru# 8000 000D ???
  30.  
  31.   In the third routine, I'm trying to use pure FPU code. Of course,
  32. this would be the most ideal routine to use. Again GURU# 8000 000D
  33.  
  34.   I think I've checked the FPU with AIBB 5.0. The performance seems
  35. to be what I'm looking for and is much much better than when I finally
  36. installed the FPU a week ago. A1200 / GVP 030 + 68882 @ 50mHz. OS3.1
  37.  
  38.  Is there something extra or special that I seem to be missing????
  39.  I would surely hate to have to go to the '060 [Blizzard 1260] and FFP :(
  40.  
  41. Thank you very much,
  42.  
  43. Best regards,
  44.     
  45. ;--------------------------------------------------------------
  46. * Version #1
  47.  
  48.  move.l  _MathBase,a6
  49.  jsr     _LVOSPFlt(a6)
  50.  move.l  d0,DR                
  51.  move.l  d0,DI                
  52.  
  53.  lea     XRlft,a1
  54.  lea     XIlft,a2
  55.  lea     CosFFP,a4
  56.  lea     SinFFP,a5
  57.  
  58.  moveq   #$20,d7              ; FOR I=0 TO 32
  59. LOOP1:
  60.  move.l  (a1),d0          
  61.  move.l  DR,d1
  62.  jsr     _LVOSPAdd(a6)
  63.  move.l  d0,d5                ; TR=XR(I)+DR
  64.  
  65.  move.l  (a2),d0 
  66.  move.l  DI,d1
  67.  jsr     _LVOSPAdd(a6)
  68.  move.l  d0,d6                ; TI=XI(I)+DI
  69.  
  70.                               ; a  TR in d1
  71.                               ; c  TI in d2
  72.  move.l  (a4)+,d3             ; b  ER(I)
  73.  move.l  (a5)+,d4             ; d  EI(I)
  74.  
  75.  move.l  d5,d0
  76.  move.l  d4,d1
  77.  jsr     _LVOSPMul(a6)
  78.  move.l  d0,WT                ; EI(I)*TR
  79.  
  80.  move.l  d6,d0
  81.  move.l  d4,d1
  82.  jsr     _LVOSPMul(a6)
  83.  move.l  d0,XT                ; EI(I)*TI
  84.  
  85.  move.l  d5,d0
  86.  move.l  d3,d1
  87.  jsr     _LVOSPMul(a6)
  88.  move.l  d0,YT                ; ER(I)*TR
  89.  
  90.  move.l  d6,d0
  91.  move.l  d3,d1
  92.  jsr     _LVOSPMul(a6)
  93.  move.l  d0,ZT                ; ER(I)*TI
  94.  
  95.  move.l  YT,d0
  96.  move.l  XT,d1
  97.  jsr     _LVOSPSub(a6)
  98.  move.l  d0,(a1)+             ; XR(I)=ER(I)*TR-EI(I)*TI
  99.  
  100.  move.l  WT,d0
  101.  move.l  ZT,d1
  102.  jsr     _LVOSPAdd(a6)
  103.  move.l  d0,(a2)+             ; XI(I)=ER(I)*TI+EI(I)*TR      
  104.  
  105.  dbf     d7,LOOP1
  106.  
  107. ;--------------------------------------------------------
  108.  
  109.  movea.l _MathIEEESingBase,a6
  110.  jsr     _LVOIEEESPFlt(a6)
  111.  move.l  d0,DR                
  112.  move.l  d0,DI                
  113.  
  114.  lea     XRlft,a1
  115.  lea     XIlft,a2
  116.  lea     SPCos,a4
  117.  lea     SPSin,a5
  118.  
  119.  moveq   #$20,d7              ; FOR I=0 TO 32
  120. LOOP1:
  121.  move.l  (a1),d0          
  122.  move.l  DR,d1
  123.  jsr     _LVOIEEESPAdd(a6)
  124.  move.l  d0,d5                ; TR=XR(I)+DR
  125.  
  126.  move.l  (a2),d0 
  127.  move.l  DI,d1
  128.  jsr     _LVOIEEESPAdd(a6)
  129.  move.l  d0,d6                ; TI=XI(I)+DI
  130.  
  131.                               ; a  TR in d1
  132.                               ; c  TI in d2
  133.  move.l  (a4)+,d3             ; b  ER(I)
  134.  move.l  (a5)+,d4             ; d  EI(I)
  135.  
  136.  move.l  d5,d0
  137.  move.l  d4,d1
  138.  jsr     _LVOIEEESPMul(a6)
  139.  move.l  d0,WT                ; EI(I)*TR
  140.  
  141.  move.l  d6,d0
  142.  move.l  d4,d1
  143.  jsr     _LVOIEEESPMul(a6)
  144.  move.l  d0,XT                ; EI(I)*TI
  145.  
  146.  move.l  d5,d0
  147.  move.l  d3,d1
  148.  jsr     _LVOIEEESPMul(a6)
  149.  move.l  d0,YT                ; ER(I)*TR
  150.  
  151.  move.l  d6,d0
  152.  move.l  d3,d1
  153.  jsr     _LVOIEEESPMul(a6)
  154.  move.l  d0,ZT                ; ER(I)*TI
  155.  
  156.  move.l  YT,d0
  157.  move.l  XT,d1
  158.  jsr     _LVOIEEESPSub(a6)
  159.  move.l  d0,(a1)+             ; XR(I)=ER(I)*TR-EI(I)*TI
  160.  
  161.  move.l  WT,d0
  162.  move.l  ZT,d1
  163.  jsr     _LVOIEEESPAdd(a6)
  164.  move.l  d0,(a2)+             ; XI(I)=ER(I)*TI+EI(I)*TR      
  165.  
  166.  dbf     d7,LOOP1
  167.  
  168. ***********************************************************
  169.  
  170.  lea     XRlft,a1
  171.  lea     XIlft,a2
  172.  lea     SPCos,a5
  173.  lea     SPSin,a6
  174.  
  175.  fmove.l d0,fp0
  176.  
  177.  moveq   #$20,d7              ; FOR I=0 TO 32
  178. LOOP1:
  179.  fmove.s (a1),fp1        
  180.  fadd.s  fp0,fp1              ; TR=XR(I)+DR
  181.  fmove.s (a2),fp2
  182.  fadd.s  fp0,fp2              ; TI=XI(I)+DI
  183.  
  184.                               ; a  TR in d1
  185.                               ; c  TI in d2
  186.  fmove.s (a5)+,fp3            ; b  ER(I)
  187.  fmove.s (a6)+,fp4            ; d  EI(I)
  188.        
  189.  fmove.s fp1,fp5
  190.  fmove.s fp2,fp6               
  191.  
  192.  fsglmul fp4,fp1              ; TR*EI(I)
  193.  fsglmul fp4,fp2              ; TI*EI(I)
  194.  fsglmul fp3,fp5              ; TR*ER(I)
  195.  fsglmul fp3,fp6              ; TI*ER(I)
  196.  
  197.  fsub.s  fp2,fp5              ; ER(I)*TI-EI(I)*TR
  198.  fadd.s  fp1,fp6              ; ER(I)*TR+EI(I)*TI      
  199.  
  200.  fmove.s fp5,(a1)+            ; XR(I)=ER(I)*TI-EI(I)*TR
  201.  fmove.s fp6,(a2)+            ; XI(I)=ER(I)*TR+EI(I)*TI
  202.   
  203.  dbf     d7,LOOP1
  204.  
  205. ************************************************************
  206.  
  207. SPCos:
  208.  dc.s  1.000000 
  209.  dc.s  .9951847 
  210.  dc.s  .9807853 
  211.  dc.s  .9569404 
  212.  dc.s  .9238795 
  213.  dc.s  .8819213 
  214.  dc.s  .8314696 
  215.  dc.s  .7730104 
  216.  dc.s  .7071067 
  217.  dc.s  .6343933 
  218.  dc.s  .5555701 
  219.  dc.s  .4713967 
  220.  dc.s  .3826835 
  221.  dc.s  .2902847 
  222.  dc.s  .1950903 
  223.  dc.s  9.801716-E02 
  224.  dc.s  -1.192093-E07 
  225.  dc.s  -9.801722-E02 
  226.  dc.s  -.1950903 
  227.  dc.s  -.2902848 
  228.  dc.s  -.3826835 
  229.  dc.s  -.4713968 
  230.  dc.s  -.5555705 
  231.  dc.s  -.6343932 
  232.  dc.s  -.7071067 
  233.  dc.s  -.7730105 
  234.  dc.s  -.8314697 
  235.  dc.s  -.8819214 
  236.  dc.s  -.9238797 
  237.  dc.s  -.9569404 
  238.  dc.s  -.9807854 
  239.  dc.s  -.9951848 
  240.  dc.s  -1.000000 
  241.  dc.s  -.9951845 
  242.  dc.s  -.9807854 
  243.  dc.s  -.9569402 
  244.  dc.s  -.9238795 
  245.  dc.s  -.8819212 
  246.  dc.s  -.8314697   
  247.  dc.s  -.7730105 
  248.  dc.s  -.7071067 
  249.  dc.s  -.6343933 
  250.  dc.s  -.5555701 
  251.  dc.s  -.4713968 
  252.  dc.s  -.382683 
  253.  dc.s  -.2902845 
  254.  dc.s  -.1950903 
  255.  dc.s  -9.801686-E02 
  256.  dc.s  -1.192093-E07 
  257.  dc.s  9.801728-E02 
  258.  dc.s  .1950904 
  259.  dc.s  .2902851 
  260.  dc.s  .3826836 
  261.  dc.s  .4713967 
  262.  dc.s  .5555704 
  263.  dc.s  .6343933 
  264.  dc.s  .707107 
  265.  dc.s  .7730106 
  266.  dc.s  .8314695 
  267.  dc.s  .8819214 
  268.  dc.s  .9238795 
  269.  dc.s  .9569404 
  270.  dc.s  .9807853 
  271.  dc.s  .9951848 
  272.  
  273. SPSin:
  274.  dc.s  0 
  275.  dc.s  9.801714-E02 
  276.  dc.s  .1950903 
  277.  dc.s  .2902847 
  278.  dc.s  .3826835 
  279.  dc.s  .4713967 
  280.  dc.s  .5555702 
  281.  dc.s  .6343933 
  282.  dc.s  .7071068 
  283.  dc.s  .7730104 
  284.  dc.s  .8314697 
  285.  dc.s  .8819213 
  286.  dc.s  .9238795 
  287.  dc.s  .9569404 
  288.  dc.s  .9807854 
  289.  dc.s  .9951847 
  290.  dc.s  1.000000 
  291.  dc.s  .9951847 
  292.  dc.s  .9807853 
  293.  dc.s  .9569404 
  294.  dc.s  .9238795 
  295.  dc.s  .8819212 
  296.  dc.s  .8314695 
  297.  dc.s  .7730105 
  298.  dc.s  .7071068 
  299.  dc.s  .6343933 
  300.  dc.s  .5555702 
  301.  dc.s  .4713966 
  302.  dc.s  .3826833 
  303.  dc.s  .2902847 
  304.  dc.s  .1950903 
  305.  dc.s  9.801709-E02 
  306.  dc.s  -8.742791-E08 
  307.  dc.s  -9.801726-E02 
  308.  dc.s  -.1950905 
  309.  dc.s  -.2902849 
  310.  dc.s  -.3826835 
  311.  dc.s  -.4713968 
  312.  dc.s  -.5555703 
  313.  dc.s  -.6343933 
  314.  dc.s  -.7071068 
  315.  dc.s  -.7730104 
  316.  dc.s  -.8314698 
  317.  dc.s  -.8819213 
  318.  dc.s  -.9238797 
  319.  dc.s  -.9569404 
  320.  dc.s  -.9807853 
  321.  dc.s  -.9951848
  322.  dc.s  -1.000000 
  323.  dc.s  -.9951847 
  324.  dc.s  -.9807853 
  325.  dc.s  -.9569402 
  326.  dc.s  -.9238795 
  327.  dc.s  -.8819213 
  328.  dc.s  -.8314695 
  329.  dc.s  -.7730104 
  330.  dc.s  -.7071065 
  331.  dc.s  -.6343932 
  332.  dc.s  -.5555703 
  333.  dc.s  -.4713966 
  334.  dc.s  -.3826835 
  335.  dc.s  -.2902844 
  336.  dc.s  -.1950902 
  337.  dc.s  -9.801676-E02 
  338.  
  339. --
  340.     .-.                                                               .-.
  341.    /   \           .-.                                 .-.           /   \
  342.   /     \         /   \       .-.     _     .-.       /   \         /     \
  343. -/--Chuck Davis -------\-----/---\---/-\---/---\-----/-----\-------/-------\--
  344.     roshicorp@roshi.corp.earthlink.net  `-'     \   /       \     /
  345.            \   /         `-'                     `-'         \   /
  346.             `-'                                               `-'
  347.  
  348.  
  349.  
  350. -- 
  351.                                 Michael van Elst
  352.  
  353. Internet: mlelstv@serpens.rhein.de
  354.                                 "A potential Snark may lurk in every tree."
  355.